#ifndef REUSABLEBODYDEF_H
#define REUSABLEBODYDEF_H

#include <Box2D/Box2D.h>
#include "Common/Common.h"
#include "TextureInfo.h"

class ReusableBodyDef
{
public:
	ReusableBodyDef( float mass, float inertia, float friction, float resitution );
	~ReusableBodyDef();

	inline float GetMass() const { return m_massData->mass; }
	inline void SetMass( float mass ) { m_massData->mass = mass; }

	inline float GetInertia() const { return m_massData->I; }
	inline void SetInertia( float inertia ) { m_massData->I = inertia; }

	inline float GetFriction() const { return m_friction; }
	void SetFriction( float friction );

	inline float GetRestitution() const { return m_restitution; }
	void SetRestitution( float inertia );

	void AddCircle( const cmn::Circle& circle );
	void AddPolygon( const cmn::Polygon& polygon );

	inline const b2MassData* GetMassData() const { return m_massData; }
	inline const cmn::IIterable<b2FixtureDef*>* GetFixtureDefs() const { return m_fixtureDefs; }

private:
	b2FixtureDef* CreateFixtureDef( const b2Shape* shape );
	b2CircleShape* CreateCircle( const cmn::Circle& circle );
	b2PolygonShape* CreatePolygon( const cmn::Polygon& polygon );

private:
	float m_friction;
	float m_restitution;
	cmn::Vector<b2FixtureDef*>* m_fixtureDefs;
	b2MassData* m_massData;
};

#endif
